<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <!-- 移动端视口说明 -->
		<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">

		<title><?php echo C('WEB_TITLE');?></title>

		<link rel="stylesheet" href="/Public/css/common.css"/>

		<link rel="stylesheet" href="/Public/js/layui/css/layui.css"/>

        <link rel="stylesheet prefetch" href="/Public/js/photoswipe/photoswipe.css">

        <link rel="stylesheet prefetch" href="/Public/js/photoswipe/default-skin/default-skin.css">

		<link rel="stylesheet" href="/Public/mobile/css/crm-mobile-terminal.css"/>
		<link rel="stylesheet" href="/Public/js/jeDate/skin/jedate.css">
		<link rel="stylesheet" href="/Public/js/mobile-date/mobile-date.css">
		<link rel="stylesheet" href="/Public/js/mobileSelect/mobileSelect.css">

        <link rel="stylesheet" href="<?php echo C('MOBILE_ICON_HTTP');?>"/>

		<script type="text/javascript" >

			const moduleName = "<?php echo (MODULE_NAME); ?>";

		</script>

		<script type="text/javascript" src="/Public/js/jquery-1.9.1.min.js"></script>

		<script type="text/javascript" src="/Public/js/cookie/jquery.cookie.js"></script>

		<script type="text/javascript" src="/Public/js/lang/<?php echo (getStrToLower(cookie('think_language'))); ?>.js"></script>

		<script type="text/javascript" src="/Public/js/layer/layer.js"></script>

		<script type="text/javascript" src="/Public/js/layui/layui.js"></script>

		<script type="text/javascript" src="/Public/js/WeChat/wechatglobal.js"></script>

		<script type="text/javascript" src="/Public/js/WeChat/wechatupload.js"></script>

		<script type="text/javascript" src="/Public/js/photoswipe/photoswipe.min.js"></script>

		<script type="text/javascript" src="/Public/js/photoswipe/photoswipe-ui-default.min.js"></script>

        <script type="text/javascript" src="/Public/js/WeChat/iscroll.js"></script>

		<script type="text/javascript" src="/Public/js/mobile-date/mobile-date.js"></script>
		
		<script type="text/javascript" src="/Public/js/jeDate/src/jedate.js"></script>
		
		<script type="text/javascript" src="/Public/mobile/js/crm-window.js"></script>
		
		<script type="text/javascript" src="/Public/js/feeldesk-slide.js"></script>

		<script type="text/javascript" src="/Public/js/photoswipe/photohtml.js"></script>

		<style type="text/css">

            body{background-color: #fafafa}

        </style>

		<script type="text/javascript" src="/Public/js/uni.webview.1.5.2.js"></script>

		<script type="text/javascript">

			//整合版：当前页为首页发送消息给整合系统并更改页面样式
			if(self!=top)
			{
				var isIframe=true;
			}

			var isFeelecApp = false;

			if(isIframe)
			{
				document.addEventListener("UniAppJSBridgeReady", function ()
				{
					uniPostHome();
				});
			}

			document.addEventListener('UniAppJSBridgeReady', function()
			{
				uni.getEnv(function(res)
				{
					if (res.plus)//res.h5
					{
						isFeelecApp = true;

						uniPostHome();
					}
				});
			});

			function uniPostHome()
			{
				var think_controller = "<?php echo (CONTROLLER_NAME); ?>";
				var think_action = "<?php echo (ACTION_NAME); ?>";

				if(think_controller+"/"+think_action == "Index/index")
				{
					uni.postMessage({
						data: {
							isHome: true
						}
					});
				}
				else
				{
					uni.postMessage({
						data: {
							isHome: false
						}
					});
				}
			}

		</script>

	</head>

    <body>



<div class="feeldesk">

    <header>

        <div class="menu-header">

            <a href="javascript:history.go(-1);location.replace(document.referrer)" class="iconfont icon-back-left back"></a>

            <div class="header-title"><?php echo L('CUSTOMER_CONTACT');?></div>

			<?php if(!empty($isCreateContacterAuth)): ?><a href="<?php echo U('Customer/create_contacter');?>" class="header-right"><?php echo L('ADD');?></a><?php endif; ?>

        </div>

    </header>

    <div class="feeldesk-main plr2 feelcrm-footer-list">

        <div class='feeldesk-item' id='customerItem'>



        </div>

        <div class="buoy-shade hidden"></div>

<div class="feeldesk-buoy">

    <div class="operate-buoy hidden">

        <?php if($groupSystemAuth['crm_auth'] == 1 && $isCreateCrmClueAuth > 0): ?><a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/CrmMobile/Clue/create" class="crm-buoy"><span><?php echo L('ADD_CLUE');?></span><img src="/Public/mobile/img/clue-buoy.png" alt="" width="100%"></a><?php endif; ?>

        <?php if($groupSystemAuth['crm_auth'] == 1 && $isCreateCrmCustomerAuth > 0): ?><a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/CrmMobile/Customer/create" class="crm-buoy"><span><?php echo L('ADD_CUSTOMER');?></span><img src="/Public/mobile/img/crm-buoy.png" alt="" width="100%"></a><?php endif; ?>

        <?php if($groupSystemAuth['crm_auth'] == 1 && $isCreateCrmOpportunityAuth > 0): ?><a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/CrmMobile/Opportunity/create" class="crm-buoy"><span><?php echo L('ADD_OPPORTUNITY');?></span><img src="/Public/mobile/img/opportunity-buoy.png" alt="" width="100%"></a><?php endif; ?>

        <?php if($groupSystemAuth['ticket_auth'] == 1 && $isCreateTicketAuth > 0): ?><a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/Mobile/Ticket/template" class="ticket-buoy"><span><?php echo L('CREATE_TICKET');?></span><img src="/Public/mobile/img/ticket-buoy.png" alt="" width="100%"></a><?php endif; ?>

    </div>

    <a href="javascript:" class="create-buoy"><img src="/Public/mobile/img/feeldesk-buoy.png" alt="" width="100%" class="transfer0"></a>

</div>

<script type="text/javascript">

	$(function()
	{
		$('.create-buoy').unbind('click').on('click',function()
		{
			var createBuoy = $(this).find('img');

			createBuoy.toggleClass('transfer45').toggleClass('transfer0');

			$('.operate-buoy').fadeToggle('300');

			$('.buoy-shade').fadeToggle('fast').unbind('click').on('click',function()
			{
				$('.operate-buoy').fadeOut('fast');

				$(this).fadeOut('fast');

				createBuoy.toggleClass('transfer45').toggleClass('transfer0');
			});
		})
	})

</script>


    </div>

</div>


<div class="feeldesk-footer">

    <style>
        .footer-nav li{width:calc(100% / 3) !important;}
    </style>

    <ul class="footer-nav">

        <li class="fl" >

            <a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/<?php echo ($system); ?>" class="<?php if((CONTROLLER_NAME) == "Index"): ?>active<?php endif; ?>">

                <i class="iconfont icon-home"></i>

                <p><?php echo L('WORKBENCH');?></p>

            </a>

        </li>

		<!--<li class="fl">

            <a href="<?php echo U('Customer/index');?>" class="<?php if((CONTROLLER_NAME) == "Customer"): ?>active<?php endif; ?>">

                <i class="iconfont icon-notify"></i>

                <p><?php echo L('CUSTOMER');?></p>

            </a>

        </li>-->

        <?php if(!empty($mobile["menuAuth"]["isCenterAuth"])): ?><li class="fr" id="ispersonal">

                <a href="<?php echo C('HTTP_PROTOCOL');?>://<?php echo C('HOST_DOMAIN');?>/Mobile/Setting/index?system=<?php echo ($system); ?>" class="<?php if((CONTROLLER_NAME) == "Setting"): ?>active<?php endif; ?>">

                    <i class="iconfont icon-my"></i>

                    <p><?php echo L('PERSONAL');?></p>

                </a>

            </li><?php endif; ?>

		<li class="fr relative messageli">

            <a href="<?php echo U('Message/getMessage');?>" class="<?php if((CONTROLLER_NAME) == "Message"): ?>active<?php endif; ?>">

                <i class="iconfont icon-notify"></i>

                <p><?php echo L('NOTIFY');?></p>

                <?php if(!empty($unReadMessageNum)): ?><span class="message-num"><?php if(($unReadMessageNum) > "99"): ?>99+<?php else: echo ($unReadMessageNum); endif; ?></span><?php endif; ?>

            </a>

        </li>

    </ul>

</div>

<script type="text/javascript">

    $(".transfer").on('click',function()
    {
        $(this).find('i').toggleClass('icon-tianjia2');

        $(".transfer-nav").slideToggle('fast');

        $("#ticketPannel").toggleClass('pb120');
    })

    //整合版：当前页为首页发送消息给整合系统并更改页面样式
    if (isIframe || isFeelecApp)
    {
        $('.footer-nav li').css('cssText', 'width:calc(100% / 2) !important;');

        $('#ispersonal').hide();
    }
</script>

<script type="text/javascript">

    layui.use('flow', function()
    {
        var flow = layui.flow;

		var isDeleteContacterAuth = '<?php echo ($isDeleteContacterAuth); ?>';

        flow.load(
        {
            elem: '#customerItem',
            scrollElem:'.feeldesk-main',
            isAuto:false,
            done: function(page, next)
            {
                var url = "<?php echo (ACTION_NAME); ?>";

                var lis = [];

                $.get("<?php echo U('customer/'.ACTION_NAME);?>?p="+page+"&request=flow", function(data)
                {
                    layui.each(data.data, function(index, item)
                    {
                        var url = "<?php echo U('Customer/edit_contacter');?>?id="+item.contacter_id;

                        var deleteUrl = "<?php echo U('Customer/delete_contacter');?>?id="+item.contacter_id;

                        var customerUrl = "<?php echo U('Customer/detail');?>?id="+item.customer_id;

                        var isRead = '';

                        if(item.look == 2)
                        {
                            isRead = 'ticket-read';
                        }

						if(item.contacter_id == item.first_contact_id)
						{
							 var items = "<div class='feeldesk-list feelcrm-mobile-list'>" +
                                 "<a href='"+url+"' class='clearfix customer-item'>" +
                                     "<div class='feeldesk-list-left'>" +
                                        "<div class='customer-name ellipsis'>"+item.detail.name+"<span class='customer-first'>(<?php echo L('PRIMARY');?>)</span></div>" +
                                        "<div class='customer-server'><?php echo L('CONTACT_WAY');?>："+item.detail.phone+"</div>" +
                                        "<div class='customer-server ellipsis'><?php echo L('OWNED_CUSTOMER');?>：<span class='blue8' onclick='tocrmdetail(\""+customerUrl+"\")'>"+item.customer_name+"</span></div>" +
                                    "</div>" +
                                     "<div class='feeldesk-list-right'><span >"+item.member_name+"</span></div>" +
                                     "<div class='clear'></div>" +
                                 "</a>" +
                                 "<span class='customer-delete'><a href='"+deleteUrl+"' class='iconfont icon-delete' mini='delete'></a></span></div>";
						}
						else
						{
							 var items = "<div class='feeldesk-list feelcrm-mobile-list'>" +
                                 "<a href='"+url+"' class='clearfix customer-item'>" +
                                    "<div class='feeldesk-list-left'>" +
                                        "<div class='customer-name ellipsis'>"+item.detail.name+"</div>" +
                                        "<div class='customer-server'><?php echo L('CONTACT_WAY');?>："+item.detail.phone+"</div>" +
                                        "<div class='customer-server ellipsis'><?php echo L('OWNED_CUSTOMER');?>：<span class='blue8' onclick='tocrmdetail(\""+customerUrl+"\")'>"+item.customer_name+"</span></div>" +
                                    "</div>" +
                                    "<div class='feeldesk-list-right'><span >"+item.member_name+"</span></div>" +
                                    "<div class='clear'></div>" +
                                 "</a>" +
                                 "<span class='customer-delete'><a href='"+deleteUrl+"' class='iconfont icon-delete' mini='delete'></a></span></div>";
						}


                        lis.push(items);
                    });

                    next(lis.join(''), page < data.pages);
                });

            }
        });
    });

</script>